<?

//okay need to work out the mode and group from that to constrain the search by.
$gid = groupForMode($viewMode, $db);
$mode = groupObjectForMode($viewMode, $db);//echo "Mode = <pre>";print_r($mode);echo "</pre>";

$cmsDocument->flush();
$cmsDocument->addDocumentType("docCMSWebPge");
$cmsDocument->addConstraint("shortdescription", $gid); //Site Group
$cmsDocument->resetIterator();
$row = $cmsDocument->nextDocument();


	$labelLocation="cms";
	if (!in_array( $mode->modecode, array("intranet","cms","mailout","site","admin","",null))){
		$labelLocation = "site";
	}

?>
<div>
<img alt="<?=$mode->groupname?>" src="/<?= $labelLocation ?>/images/mode_icon_<?=$mode->modecode?>.gif" style="display:inline;" align="left"/><img src="/cms/images/spacer.gif" width="30" align="left" />
<br><span style="text-transform: uppercase; font-size: 25px; font-weight:bold; color: #e09d19;letter-spacing: 1px;display:inline;"><?if($row->title != '') echo $row->title; else echo $mode->groupname;?></span>
</div>
<br /><br><br>
<!--<img src="/cms/images/mailouts_home.gif" alt="Intranet" width="148" height="73" /><br />-->
<p>
<?= $row->content; ?>
</p>
<br /><br />
<?

$cmsDocument->flush();
$cmsDocument->addDocumentType("docCMSQuLink");
$cmsDocument->addConstraint("categorycode", $gid); //Site
$cmsDocument->addSort("content + 0");
$cmsDocument->resetIterator();
if ($cmsDocument->totalDocuments()) {
?>
<p><img src="/cms/images/quick_links.gif" alt="Quick Links" width="645" height="22" /></p>

    <table width="90%" border="0" align="center" cellpadding="0" cellspacing="5">
<?
}
$cell = 1;
while ($row = $cmsDocument->nextDocument()) {
	if ($cell == 1) {
		echo "<tr>\n";
		echo "  <td width='50%'>\n";
		echo "    <a href='".$row->shortdescription."'>".$row->title."</a>\n";
		echo "  </td>\n";
		$cell++;
	}
	else {
		echo "  <td width='50%'>\n";
		echo "    <a href='".$row->shortdescription."'>".$row->title."</a>\n";
		echo "  </td>\n";
		echo "</tr>\n";
		echo "<tr>\n";
		echo "  <td height='5' colspan='2' background='/cms/images/spacer.gif'></td>\n";
		echo "</tr>\n";
		echo "<tr>\n";
		echo "  <td height='1' colspan='2' background='/cms/images/cnt_divider.gif'></td>\n";
		echo "</tr>\n";
		echo "<tr>\n";
		echo "  <td height='5' colspan='2' background='/cms/images/spacer.gif'></td>\n";
		echo "</tr>\n";
		$cell--;
	}
}
if ($cmsDocument->totalDocuments()) {
	if ($cell == 2) {
		echo "  <td>&nbsp;</td>\n";
		echo "</tr>\n";
		echo "<tr>\n";
		echo "  <td height='5' colspan='2' background='/cms/images/spacer.gif'></td>\n";
		echo "</tr>\n";
		echo "<tr>\n";
		echo "  <td height='1' colspan='2' background='/cms/images/cnt_divider.gif'></td>\n";
		echo "</tr>\n";
		echo "<tr>\n";
		echo "  <td height='5' colspan='2' background='/cms/images/spacer.gif'></td>\n";
		echo "</tr>\n";
	}
?>
    </table>
<?
}
?>
    <br />
    <br />
    <br />

    <img src="/cms/images/for_assistance.gif" alt="Quick Links" width="645" height="22" /><br />  
<br />
Please contact Gravtiate Ltd. Email <a href="mailto:support@gravitate.co.nz">support@gravitate.co.nz</a> or Phone +64 9 309 5015